MediaWiki:Gadget-edittop.js
Megjegyzés: közzététel után frissítened kell a böngésződ gyorsítótárát, hogy lásd a változásokat.
- Firefox / Safari: tartsd lenyomva a Shift gombot és kattints a Frissítés gombra a címsorban, vagy használd a Ctrl–F5 vagy Ctrl–R (Macen ⌘–R) billentyűkombinációt
- Google Chrome: használd a Ctrl–Shift–R (Macen ⌘–Shift–R) billentyűkombinációt
- Internet Explorer / Edge: tartsd nyomva a Ctrl-t, és kattints a Frissítés gombra, vagy nyomj Ctrl–F5-öt
- Opera: Nyomj Ctrl–F5-öt
function addSectionEditLinkZero( $content ) {
if ( typeof window.oldEditsectionLinks != 'undefined' && oldEditsectionLinks === true ) {
return;
}
var $headings = $content.find( 'h1,h2,h3,h4,h5,h6' ),
headings = !!$headings.find( 'span.mw-headline' ).length,
sectioneditlinks = !!$headings.find( 'span.mw-editsection' ).length,
$edit = $( '#ca-edit' ); // add lead section edit link
if ( headings && !sectioneditlinks ) {
// if sections are not editable, don't add
return;
} else if ( !headings ) {
// try to guess whether sections would be editable; don't add if
// 1) article is protected or otherwise uneditable
// 2) user is viewing page history, edit/move/delete interface, etc.
// 3) user is viewing a special page
// 4) user is viewing a diff, unless it's a diff to the current revision
// 5) user is viewing a permalink to a revision, unless it's the current revision
var conf = mw.config.get( [ 'wgAction', 'wgNamespaceNumber' ] );
if ( !$edit.length || conf.wgAction != 'view' || conf.wgNamespaceNumber < 0 ) {
return;
}
var diff = mw.util.getParamValue( 'diff' ),
oldid = mw.util.getParamValue( 'oldid' );
if ( oldid && diff ) {
if ( diff != mw.config.get( 'wgCurRevisionId' ) && !( diff == 'prev' && oldid == mw.config.get( 'wgCurRevisionId' ) ) ) {
return;
}
} else if ( oldid ) {
if ( oldid != mw.config.get( 'wgCurRevisionId' ) ) {
return;
}
}
// covers most cases, "diff=next&oldid=<last before current>" is impossible to catch
}
var href = $edit.find( 'a' ).attr( 'href' ) + '§ion=0';
if ( headings ) {
// no need to show info about how to edit the whole page if there are no sections
href += '&editintro=MediaWiki:Editintro-section-0';
}
var $edit0 = $( '<span>' ).addClass( 'mw-editsection' );
$edit0.html( '[<a href="' + href + '">bevezető szerkesztése</a>]' );
// #firstHeading is not within $content, so it might not be ready yet
$( function appendSectionEditLinkZero() {
var $h1 = $( 'h1#firstHeading' );
// mw.hook can be run several times without reloading page,
// so the link could be added more than once
if ( !$h1.find( '.mw-editsection' ).length )
$h1.append( $edit0 );
} );
}
mw.hook( 'wikipage.content' ).add( addSectionEditLinkZero );